using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using XNALibrary.Game;

namespace XNALibrary.PostProcessing
{
    public class CombineFilter : BaseFilter
    {
        private int combineRender;
        private Techniques technique;

        public enum Techniques
        {
            SUM,
            SobelCombine
        }

        //Constructor
        public CombineFilter(int textureA,int textureB) : base(textureA)
        {
            //TexturaB
            this.combineRender = textureB;
        }

        public CombineFilter(int textureA, int textureB, Techniques technique)
            : base(textureA)
        {
            //TexturaB
            this.combineRender = textureB;
            this.technique = technique;
        }

        public override void Register()
        {
            Shader = BaseGame.content.Load<Effect>("Resources\\Effects\\PostProcessing\\Combine");
            switch (this.technique)
            {
                case Techniques.SUM:
                    Shader.CurrentTechnique = Shader.Techniques["SUM"];
                    break;
                case Techniques.SobelCombine:
                    Shader.CurrentTechnique = Shader.Techniques["SobelCombine"];
                    break;
            }

        }

        public override void Update()
        {
            BaseGame.device.Textures[1] = Owner.Filters[combineRender - 1].RenderTarget.GetTexture();
        }

    }
}
